<?php

class DefaultController extends Controller {

    public $content = array();

    public function actionIndex() {
        $this->layout = 'main_register';


        if (r()->isPostRequest) {
            $userRegistration = new User();
            $userRegistration->aliasAttrFormWithModel($_POST);
            if ($userRegistration->validate() && $userRegistration->checkUniqueUsernameEmail()) {
                $userRegistration->insertUserProfile($_POST['txtUsername']);
                //$this->render('about_general', array('profile_id' => $userRegistration->id_profile));
                //exit();
            } else
                $this->content['widget'] = array('application.widgets.newsletter.WSitebarRegister');
            $this->render('index');
        } else {
            $this->content['widget'] = array('application.widgets.newsletter.WSitebarRegister');
            $this->render('index');
        }
    }

}
